var slider_bottom = (function(){
	var setting = {
		totalItem		:	0,
		left			:	0,
		widthItem		:	829,
		currentPage		:	0,
		count	:	1,
		DIV				:	'.content-p-favorites ul'
	}
	
	function init(){
		setting.totalItem = Math.ceil($(setting.DIV + ' li').length / 5);
		
		$w = setting.totalItem * setting.widthItem;
		$(setting.DIV).css({'width': $w});
		
		initCSS();
		initEvent();
	}
	
	function initCSS(){
		//setting.widthItem = $(setting.DIV + ' li').width()*5;
		$('.arrowLR li.left').css({'display':'none'});
		if(setting.totalItem > 1) $('.btnNext').css({'display':'block'});
		else $('.arrowLR li.right').css({'display':'none'});
	}
	
	function initEvent(){		
		$('.arrowLR li.right').click(function() {
			nextItem();
        });
		
		$('.arrowLR li.left').click(function() { 
			prevItem(); 
        });
	}
	
	function nextItem(){
		setting.currentPage++;
		animateForArrow();
		scrolling();
		
	}
	
	function prevItem(){
		setting.currentPage--;
		animateForArrow();
		scrolling();
	}
	
	function scrolling(){
		setCssSlider();
		$(setting.DIV).stop(true,false).animate({'left':-setting.widthItem*setting.currentPage}, 500);
		//$(setting.DIV).transition({ x: -setting.widthItem*setting.currentPage });
	}
	
	function animateForArrow(){
		
		if(setting.currentPage < 0){
			setting.currentPage = setting.totalItem - 1;
		}
		else if(setting.currentPage == setting.totalItem){
			setting.currentPage = 0;
		}
	}
	
	function setCssSlider(){
		// buttons 
		console.log(setting.totalItem);
		if(setting.currentPage <= 0){
			$('.arrowLR li.left').css('display','none');
			$('.arrowLR li.right').css('display','block');
		}
		else if(setting.currentPage == setting.totalItem - 1){
			$('.arrowLR li.right').css('display','none');
			$('.arrowLR li.left').css('display','block');
		}
		else{
			$('.arrowLR li.left, .arrowLR li.right').css('display','block');
		}
	}
	return {
		init:init
	}
})();